using System;
using System.Drawing;
using System.Windows.Forms;

namespace MouseKeyboardOperationSimulator
{
    public partial class MousePositionCaptureDialog : Form
    {
        private CheckBox chkDontShowAgain;
        private Button btnOK;
        private Label lblInstructions;
        
        public bool DontShowAgain { get; private set; }
        
        public MousePositionCaptureDialog(string okHotKey, string cancelHotKey)
        {
            InitializeComponent(okHotKey, cancelHotKey);
        }
        
        private void InitializeComponent(string okHotKey, string cancelHotKey)
        {
            this.chkDontShowAgain = new CheckBox();
            this.btnOK = new Button();
            this.lblInstructions = new Label();
            this.SuspendLayout();
            
            // 
            // lblInstructions
            // 
            this.lblInstructions.Location = new Point(15, 15);
            this.lblInstructions.Size = new Size(350, 100);
            this.lblInstructions.Text = "请按以下步骤操作：\n\n" +
                "1. 点击\"确定\"后，本程序窗口将最小化\n" +
                "2. 将鼠标移动到目标位置\n" +
                $"3. 按下{okHotKey}确认选择坐标\n" +
                $"4. 按下{cancelHotKey}取消选择\n\n" +
                "注意：程序窗口将在操作完成后自动恢复。";
            
            // 
            // chkDontShowAgain
            // 
            this.chkDontShowAgain.Location = new Point(15, 120);
            this.chkDontShowAgain.Size = new Size(200, 24);
            this.chkDontShowAgain.Text = "我已知晓，不要再显示此说明";
            
            // 
            // btnOK
            // 
            this.btnOK.DialogResult = DialogResult.OK;
            this.btnOK.Location = new Point(280, 120);
            this.btnOK.Size = new Size(75, 23);
            this.btnOK.Text = "确定";
            this.btnOK.UseVisualStyleBackColor = true;
            
            // 
            // MousePositionCaptureDialog
            // 
            this.AutoScaleDimensions = new SizeF(6F, 12F);
            this.AutoScaleMode = AutoScaleMode.Font;
            this.ClientSize = new Size(370, 160);
            this.Controls.Add(this.btnOK);
            this.Controls.Add(this.chkDontShowAgain);
            this.Controls.Add(this.lblInstructions);
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.StartPosition = FormStartPosition.CenterParent;
            this.Text = "鼠标坐标采集说明";
            this.ResumeLayout(false);
        }
        
        protected override void OnFormClosed(FormClosedEventArgs e)
        {
            DontShowAgain = chkDontShowAgain.Checked;
            base.OnFormClosed(e);
        }
    }
}